package lunchy.data.classes;

import java.util.ArrayList;
import java.util.List;

import lunchy.data.interfaces.ILunchyOrder;
import lunchy.data.interfaces.ILunchyOrderItem;
import lunchy.data.interfaces.ILunchyUser;
import lunchy.main.CLunchyApplication;

public class CLunchyOrder implements ILunchyOrder
{
	private long orderID = 0;
	private List<ILunchyOrderItem> orderList;
	private ILunchyUser userOrder = null;
	
	public CLunchyOrder()
	{
		orderList = new ArrayList<ILunchyOrderItem>(0);
		userOrder = CLunchyApplication.getInstance().currentUser;
	}
	
	public long getOrderID()
	{
		return orderID;
	}

	public void setOrderID(long orderID)
	{
		this.orderID = orderID;
	}
	
	public boolean addItemToOrder(ILunchyOrderItem item)
	{
		if(item != null)
		{
			item.setItemID(item.getItem().getId());
			orderList.add(item);
			return true;
		}
		else
			return false;
	}
	
	public void setOrderList(List<ILunchyOrderItem> orderlist)
	{
		this.orderList = orderlist;
	}
	
	public List<ILunchyOrderItem> getOrderList()
	{
		return orderList;
	}

	public void setUserOrder(ILunchyUser userOrder)
	{
		this.userOrder = userOrder;
	}
	
	public ILunchyUser getUserOrder()
	{
		return userOrder;
	}
}
